from .book import BookViewModel


class MyWishes:
    def __init__(self, wishes_of_mine, gift_count_list):
        self.__wishes_of_mine = wishes_of_mine
        self.__gift_count_list = gift_count_list
        self.wishes = self.__parse()

    def __parse(self):
        temp_wishes = []
        for wish in self.__wishes_of_mine:
            temp_wishes.append(self.__matching(wish))
        return temp_wishes

    def __matching(self, wish):
        count = 0
        for gift_count in self.__gift_count_list:
            if wish.isbn == gift_count['isbn']:
                count = gift_count['count']
        return {
            'id': wish.id,
            'book': BookViewModel(wish.book),
            'gifts_count': count
        }


class MyWish:
    def __init__(self):
        pass
